﻿#ifndef PRINTREPORT_H
#define PRINTREPORT_H

#include"Beans/databean.h"
#include<QPainter>
#include<QPrinter>
#include "QFont"
#include<Beans/groupdatabeans.h>
#include<Beans/datainfobean.h>
#include"DataPro/listoperation.h"
#include "reportdataforsort.h"
#include "datamanager.h"
#include "Beans/battledatabeans.h"
#include "DataPro/fileoperation.h"
#include "constant.h"
class PrintReport
{
private:
    QPrinter *printer;
    QPainter *painter;
    QPen pen_Black;
    QFont font_Header,font_DataInfo,font_DataInfo_v,font_res;
    QFont font_subTitle;
    GroupDataBeans dataBean;
    BattleDataBeans battledataBean;
    DataInfoBean dib;
    bool isGroupOrBattle;//真团体，假-对抗
    ListOperation lo;
    bool GroupA_Ex;
    bool GroupB_Ex;
    bool GroupC_Ex;
    bool GroupD_Ex;
    QString DWName;
    QString BaseFolder=Constant::ReportPath;
    QString ChildFolder;
    FileOperation fo;
    QString ParentFolder;

public:
    PrintReport(DATAINFO_TABLE_DATA dib);
    ~PrintReport();

    void DrawTitle(int startX,int startY,QString title);
    void DrawsubTitle(int startX,int startY,QString title,int width);
    void DrawDataInfo1(int startX,int startY);
    void DrawDataInfo2(int startX,int startY);
    void DrawDataInfo3(int startX,int startY);
    void DrawResultTitle(int startX,int startY);
    void DrawResultV(int startX,int startY);
    void DrawResultV_battle(int startX,int startY);
    void DrawScoreTitle(int startX,int startY);
    void DrawScoreTitle_battle(int startX,int startY);
    void DrawScores(int mc,int startX,int startY,ReportDataForSort pdfs);
    void DrawAllScore();
    void DrawAllScore_Battle();
    void DrawLine(int startX,int startY,int width,int height,QList<double>s);
    void DrawLines(int startX,int startY,int width,int height,QList<QList<double>>s);
    QList<QList<double>> getScores();
    void DrawPies(int startX,int startY);

    void Report_group();
    void Report_battle();
    static bool compareData(const ReportDataForSort &A1,const ReportDataForSort &A2);
};

#endif // PRINTREPORT_H
